﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using LTJ.Common;
using LTJ.Entity;
using LTJ.FrameWork;

namespace LTJ.Web.UI.datacontrol
{
    /// <summary>
    /// Ajax授权航线列表
    /// </summary>
    public class ajaxcorproutelist : BaseWebControl
    {
        protected string search_txt_name = SASRequest.GetString("search_txt_name").Trim();
        protected string search_txt_ename = SASRequest.GetString("search_txt_ename").Trim();
        protected string boatstr = SASRequest.GetString("boatstr").Trim();
        protected int corpid = SASRequest.GetInt("corpid", 0);
        private string strWhere = "";

        public override void ShowUserControl()
        {
            SetBaseDataVar();

            RowsCount = Routes.GetRoutesCount(strWhere);
            dataDT = Routes.GetRoutesByPage(PageIndex, PageSize, strWhere, "", "");
            GetPageList("search_txt_ename=" + search_txt_ename + "&search_txt_name=" + search_txt_name + "&corpid=" + corpid + "&boatstr=" + boatstr);
        }

        /// <summary>
        /// 设置基本参数获取变量
        /// </summary>
        /// <returns></returns>
        private void SetBaseDataVar()
        {
            if (corpid <= 0) corpid = compid;

            if (controllername == "ajaxcorproutelist.ascx")
            {
                showdiv = "ajaxcorproutedatalist";
                strWhere = Routes.GetRouteStrWhere(corpid, search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxcorproutecarrierlist.ascx" || controllername == "ajaxcorproutecarrierlist_list.ascx")
            {
                showdiv = "ajaxroutecarrierdatalist";
                strWhere = Routes.GetRouteBoatStrWhere(corpid, search_txt_name, search_txt_ename);
            }
            else if (controllername == "ajaxcorproutesealist.ascx" || controllername == "ajaxcorproutesealist_list.ascx")
            {
                showdiv = "ajaxcorproutedatalist";
                strWhere = Routes.GetRouteSeaStrWhere(corpid, search_txt_name, search_txt_ename, boatstr);
            }
        }
    }
}
